using MediatR;
using B.S.RbacData.ErrorCode;
using System.ComponentModel.DataAnnotations;

namespace SupplierCustomerManagement.Write.API.Applications.Commands.productpurchaseprices
{
    /// <summary>
    /// 添加商品采购价格命令
    /// </summary>
    public class AddProductPurchasePriceCommand : IRequest<ApiResult<int>>
    {
        /// <summary>
        /// 供应商ID
        /// </summary>
        [Required(ErrorMessage = "供应商ID不能为空")]
        public int SupplierId { get; set; }

        /// <summary>
        /// 商品名称
        /// </summary>
        [Required(ErrorMessage = "商品名称不能为空")]
        [StringLength(200, ErrorMessage = "商品名称长度不能超过200个字符")]
        public string ProductName { get; set; } = string.Empty;

        /// <summary>
        /// 商品规格
        /// </summary>
        [Required(ErrorMessage = "商品规格不能为空")]
        [StringLength(200, ErrorMessage = "商品规格长度不能超过200个字符")]
        public string Specification { get; set; } = string.Empty;

        /// <summary>
        /// 计量单位
        /// </summary>
        [Required(ErrorMessage = "计量单位不能为空")]
        [StringLength(50, ErrorMessage = "计量单位长度不能超过50个字符")]
        public string MeasurementUnit { get; set; } = string.Empty;

        /// <summary>
        /// 开票价格
        /// </summary>
        [Required(ErrorMessage = "开票价格不能为空")]
        [Range(0, double.MaxValue, ErrorMessage = "开票价格必须大于等于0")]
        public decimal InvoicePrice { get; set; }

        /// <summary>
        /// 结算价格
        /// </summary>
        [Required(ErrorMessage = "结算价格不能为空")]
        [Range(0, double.MaxValue, ErrorMessage = "结算价格必须大于等于0")]
        public decimal SettlementPrice { get; set; }

        /// <summary>
        /// 折扣
        /// </summary>
        [Range(0, 100, ErrorMessage = "折扣必须在0-100之间")]
        public decimal Discount { get; set; }

        /// <summary>
        /// 公有价格
        /// </summary>
        [Required(ErrorMessage = "公有价格不能为空")]
        [Range(0, double.MaxValue, ErrorMessage = "公有价格必须大于等于0")]
        public decimal PublicPrice { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        [Required(ErrorMessage = "开始日期不能为空")]
        public DateTime StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        [Required(ErrorMessage = "结束日期不能为空")]
        public DateTime EndDate { get; set; }

        /// <summary>
        /// 方案名称
        /// </summary>
        [Required(ErrorMessage = "方案名称不能为空")]
        [StringLength(200, ErrorMessage = "方案名称长度不能超过200个字符")]
        public string SchemeName { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(1000, ErrorMessage = "备注长度不能超过1000个字符")]
        public string? Remarks { get; set; }
    }
}